function Lbt(el){
    this.el = document.querySelector(el);
    this.num = 1;
    this.t = null;
    this.init();
}
Lbt.prototype.init = function(){
    this.changeImg();
    // this.tbCircle(this.num);
    this.circleOverOut();
}

//间隔换图
Lbt.prototype.changeImg = function(){
    this.t = setInterval(()=>{
        this.num++;
        if(this.num>6) this.num = 1;
        let imgObjs = this.el.querySelector('img');
        imgObjs.src = `./imgs/img${this.num}.jpg`;
        this.tbCircle(this.num);
    },1000)
}

//同步分页器
Lbt.prototype.tbCircle = function(num){
    let circleObjs = this.el.querySelectorAll('ul li');
    this.el.querySelector('ul li.active').className = '';
    circleObjs[num-1].className = 'active';
}

//分页器绑定移入移出事件
Lbt.prototype.circleOverOut = function(){
    let circleObjs = this.el.querySelectorAll('ul li');
    circleObjs.forEach((item,i)=>{
        item.onmouseover = ()=>{
            clearInterval(this.t);
            this.num = i+1;
            this.tbCircle(this.num);
            this.el.querySelector('img').src = `./imgs/img${this.num}.jpg`;
        }
        item.onmouseout = ()=>{
            this.changeImg();
        }
    })
}